﻿@model iMyRestaurent.Models.AvailabilityModel
@{
    switch (Model.Mode)
    {
        case iMyRestaurent.Shared.Mode.Create:
        case iMyRestaurent.Shared.Mode.CreateAfterRegistering:
        case iMyRestaurent.Shared.Mode.CreateFromLocationList:
            ViewBag.NextAction = Url.Action("Create", "BusinessHours");
            ViewBag.BackAction = Url.Action("Create", "Numbering");
            break;
        case iMyRestaurent.Shared.Mode.EditFromAvailability:
            ViewBag.NextAction = Url.Action("Index", "Summary");
            ViewBag.BackAction = Url.Action("EditAvailability", "Location");
            break;
        case iMyRestaurent.Shared.Mode.EditFromLayout:
        case iMyRestaurent.Shared.Mode.EditFromLocation:
            ViewBag.NextAction = Url.Action("Index", "Summary");
            ViewBag.BackAction = Url.Action("Edit", "Numbering");
            break;
    }

    ViewBag.Title = "iMyRestaurant - Set iMyTable Availability";
    Layout = "~/Views/Shared/_Layout.cshtml";
}
@section import {
    @NoCache.Instance.Css(Url, "~/Content/table-layout.css")
    @NoCache.Instance.Css(Url, "~/Content/Layout.css")
    @NoCache.Instance.Javascript(Url, "~/Scripts/zoom.js")
}
<div id="title">
    <text>iMyRestaurant – Set iMyTable availability for @Model.LocationName</text>
</div>
<div class="clearfix">
    <div class="right" style="margin: 5px 2px 5px 2px;">
        <input type="button" class="image-button button-zoom-in" />
    </div>
    <div class="right" style="margin: 5px 2px 5px 2px;">
        <input type="button" class="image-button button-zoom-out" />
    </div>
</div>
<div class="opacity-box center-box">
    <div class="auto-height-div clearfix -fl-ah" fla-step="10" id="layout-containment">
        <div id="layout">
            @foreach (var table in Model.Tables)
            {
                var layoutCode = (!string.IsNullOrEmpty(table.LayoutCode) && Convert.ToInt32(table.LayoutCode) > 0) ? table.LayoutCode : "";

                string className = table.IsAvailableOniMyTable == 1 ? "avail-icon" : "unavail-icon";
                <div class="table" id="@table.TableID" style="@table.Css.Table">
                    <div class="table-elements">
                        <div class="layout-code" style="@table.Css.Layout">@layoutCode</div>
                        <div class="number-seat" style="@table.Css.Number">
                            <div style="@table.Css.NumberText">@table.NoOfChairs</div>
                        </div>
                        <div class="@(className + " clearfix")" id="avail-status" style="@table.Css.Avail">
                        </div>
                    </div>
                    <div class="hidden" id="origin-status">@table.IsAvailableOniMyTable</div>
                </div>
            }
        </div>
    </div>
    <div class="clearfix">
        <div class="left" style="margin-top: 20px;">
            <button type="button" class="image-button button-back">
            </button>
        </div>
        <div class="left" style="margin-top: 20px;">
            <button type="button" class="image-button button-cancel">
            </button>
        </div>
        <div class="left" style="margin-left: 20px;">
            <div class="avail-desc" style="padding-bottom: 2px;">
                <text>Table is available for reservations on iMyTable application</text>
            </div>
            <div class="unavail-desc">
                <text>Table is not available for reservations on iMyTable application</text>
            </div>
        </div>
        <div class="right" style="margin-top: 20px;">
            <button type="button" class="image-button button-save">
            </button>
        </div>
    </div>
</div>
<form method="post" id="back" action="@ViewBag.BackAction"> <input type="hidden"
name="Mode" value="@Model.Mode" /> <input type="hidden" name="SummaryLocationID"
value="@Model.SummaryLocationID" /> <input type="hidden" name="SummaryDate" value="@Model.SummaryDate"
/> <input type="hidden" name="LocationID" value="@Model.LocationID" id="location-id"
/> <input type="hidden" name="LocationName" value="@Model.LocationName" /> <input
type="hidden" name="LayoutZoomScale" value="@Model.LayoutZoomScale" /> </form> <form
method="post" id="next" action="@ViewBag.NextAction">
@if (Model.Mode == iMyRestaurent.Shared.Mode.Create || Model.Mode == iMyRestaurent.Shared.Mode.CreateAfterRegistering)
{
    <input type="hidden" name="Mode" value="@Model.Mode" />
    <input type="hidden" name="LocationID" value="@Model.LocationID" />
    <input type="hidden" name="LocationName" value="@Model.LocationName" />
    <input type="hidden" name="SummaryLocationID" value="@Model.SummaryLocationID" />
    <input type="hidden" name="SummaryDate" value="@Model.SummaryDate" />
    <input type="hidden" name="LayoutZoomScale" value="@Model.LayoutZoomScale" />
}
else
{
    <input type="hidden" name="LocationID" value="@Model.LocationID" />
    <input type="hidden" name="Date" value="@Model.SummaryDate" />
}
</form>
@section script {
    @NoCache.Instance.Javascript(Url, "~/Scripts/availability.js")
}
